package com.pengtu.entity.app;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.google.common.collect.Lists;
import com.pengtu.entity.IdEntity;

/**
 * 单位
 * 
 * 注释见{@link Organization}.
 * 
 * @author calvin
 */
@Entity
@Table(name = "T_APP_ORGANIZATION")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
public class Organization extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String orgName; // 单位名称
	private String orgForm; // 单位性质
	private String burderDep; // 主管部门
	private String orgNum; // 机构代码证
	private String principal; // 负责人
	private String postCode; // 邮政编码
	private String orgTelephone; // 单位电话
	private String portraiture; // 传真
	private String orgLevel; // 级别
	private String email; // 电子邮箱
	private String orgHome; // 单位主页
	private Date finishDate; // 成立时间
	private String politicsLevel; // 行政级别
	private Date checkDate; // 考核时间
	private String moneySource; // 经费来源
	private String orgAddress; // 单位地址
	private String functionsOrg; // 单位职能
	private String basicInfo; // 基本简况
	private String remark; // 备注
	private List<User> userList = Lists.newArrayList(); // 用户信息
	private List<Department> department = Lists.newArrayList(); // 部门信息

	private String type; // 是否是内部单位

	@Column(name ="ORGNAME")
	public String getOrgName() {
		return orgName;
	}
	
	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	@Column(name = "BURDERDEP")
	public String getBurderDep() {
		return burderDep;
	}

	public void setBurderDep(String burderDep) {
		this.burderDep = burderDep;
	}

	@Column(name = "ORGNUM")
	public String getOrgNum() {
		return orgNum;
	}

	public void setOrgNum(String orgNum) {
		this.orgNum = orgNum;
	}

	@Column(name = "POSTCODE")
	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}

	@Column(name = "ORGTELEPHONE")
	public String getOrgTelephone() {
		return orgTelephone;
	}

	public void setOrgTelephone(String orgTelephone) {
		this.orgTelephone = orgTelephone;
	}

	@Column(name = "PORTRAITURE")
	public String getPortraiture() {
		return portraiture;
	}

	public void setPortraiture(String portraiture) {
		this.portraiture = portraiture;
	}

	@Column(name = "ORGLEVEL")
	public String getOrgLevel() {
		return orgLevel;
	}

	public void setOrgLevel(String orgLevel) {
		this.orgLevel = orgLevel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "ORGHOME")
	public String getOrgHome() {
		return orgHome;
	}

	public void setOrgHome(String orgHome) {
		this.orgHome = orgHome;
	}

	@Column(name = "FINISHDATE")
	@Temporal(TemporalType.DATE)
	public Date getFinishDate() {
		return finishDate;
	}

	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}

	@Column(name = "POLITICSLEVEL")
	public String getPoliticsLevel() {
		return politicsLevel;
	}

	public void setPoliticsLevel(String politicsLevel) {
		this.politicsLevel = politicsLevel;
	}

	@Column(name = "CHECKDATE")
	@Temporal(TemporalType.DATE)
	public Date getCheckDate() {
		return checkDate;
	}

	public void setCheckDate(Date checkDate) {
		this.checkDate = checkDate;
	}

	@Column(name = "MONEYSOURCE")
	public String getMoneySource() {
		return moneySource;
	}

	public void setMoneySource(String moneySource) {
		this.moneySource = moneySource;
	}

	@Column(name = "ORGADDRESS")
	public String getOrgAddress() {
		return orgAddress;
	}

	public void setOrgAddress(String orgAddress) {
		this.orgAddress = orgAddress;
	}

	@Column(name = "FUNCTIONSORG")
	public String getFunctionsOrg() {
		return functionsOrg;
	}

	public void setFunctionsOrg(String functionsOrg) {
		this.functionsOrg = functionsOrg;
	}

	@Column(name = "BASICINFO")
	public String getBasicInfo() {
		return basicInfo;
	}

	public void setBasicInfo(String basicInfo) {
		this.basicInfo = basicInfo;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(mappedBy = "organization",fetch=FetchType.LAZY)
	public List<User> getUserList() {
		return userList;
	}

	public void setUserList(List<User> userList) {
		this.userList = userList;
	}

	@OneToMany(mappedBy = "organization",fetch=FetchType.LAZY)
	public List<Department> getDepartment() {
		return department;
	}

	public void setDepartment(List<Department> department) {
		this.department = department;
	}

	@Column(name = "TYPE", insertable = false, updatable = false)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name="ORGFORM")
	public String getOrgForm() {
		return orgForm;
	}

	public void setOrgForm(String orgForm) {
		this.orgForm = orgForm;
	}
	@Column(name="PRINCIPAL")
	public String getPrincipal() {
		return principal;
	}

	public void setPrincipal(String principal) {
		this.principal = principal;
	}

}
